from rest_framework import mixins
from rest_framework.viewsets import GenericViewSet

from .models import Article
from .serializers import ArticleSerializer


class ArticleViewSet(mixins.ListModelMixin, mixins.RetrieveModelMixin, GenericViewSet):
    serializer_class = ArticleSerializer
    queryset = Article.objects.prefetch_related("tags").filter(published=True)
